package com.efa.backend.base.controller;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.efa.backend.base.entity.ProductDetail;
import com.efa.backend.base.service.ProductDetailService;
import com.efa.backend.framework.utility.DateUtil;

/**
 * @Description: TODO
 * @author zhaoxin
 * @date 2014年3月12日 下午11:48:15
 * @version V1.0
 */

@Controller
public class ProductDetailController {

	@Autowired
	private ProductDetailService productDetailService;

	/**
	 * 产品查询接口
	 * 
	 * @return
	 */
	@RequestMapping(value = "/prd/query", method = RequestMethod.GET)
	@ResponseBody
	public List<ProductDetail> productQuery() {
		int queryDay = -6;
		Date endDate = new Date();
		Date startDate = DateUtil.addDay(endDate, queryDay);
		return this.productDetailService.findByProductQuery(queryDay,
				startDate, endDate);
	}
}
